home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 120
/
Vol 120.iso
/
games
/
titans
/
beastboy.swf
/
scripts
/
DefineSprite_252
/
frame_12
/
DoAction.as
Wrap
Text File
|
2010-11-09
|
2KB
|
101 lines
onenterframe = function()
{
updatefloat();
r.xs = 0;
if(r.canpress)
{
if(Key.isDown(38))
{
r.ys = - r.runspeed;
}
else if(Key.isDown(40))
{
r.ys = r.runspeed;
}
else
{
r.ys = 0;
}
if(Key.isDown(37))
{
r.xs = - r.runspeed;
}
else if(Key.isDown(39))
{
r.xs = r.runspeed;
}
else
{
r.xs = 0;
}
}
r.nx = p._x + r.xs;
r.ny = p._y + r.ys;
if(r.nx < r.xmin)
{
r.nx = r.xmin;
}
else if(r.nx > r.xmax)
{
r.nx = r.xmax;
}
if(r.ny < r.ymin)
{
r.ny = r.ymin;
}
else if(r.ny > r.ymax)
{
r.ny = r.ymax;
}
r.x1 = r.nx - r.pw;
r.x2 = r.nx + r.pw;
r.y1 = r.ny - r.ph;
r.y2 = r.ny;
cekstep();
if(r.xs > 0)
{
r.hd = 1;
cekright(r.pbumper[r.pnow]);
}
else if(r.xs < 0)
{
r.hd = 2;
cekleft(r.pbumper[r.pnow]);
}
if(r.ys < 0)
{
up = cekup();
if(r.ny - r.ph <= up)
{
r.ny = up + r.ph + 1;
}
}
else
{
down = cekdown();
if(r.ny + r.ph >= down)
{
r.ny = down - r.ph - 1;
}
}
p._x = r.nx;
p._y = r.ny;
p.gotoAndStop("fly" + r.hd);
if(r.hit)
{
if(!r.inv)
{
gotoAndPlay(38);
}
else
{
r.hit = 0;
}
}
else if(r.mmlift)
{
gotoAndPlay(30);
}
};
stop();